import sys

import pygame
pygame.init()

width = 1000
height = 800
screen = pygame.display.set_mode((width,height))
pygame.display.set_caption('开始游戏了')
sclor = (250,250,250)

ball = pygame.image.load('aoteman (2).jpg')
ballrect = ball.get_rect()


speed=[6,6]
clock = pygame.time.Clock()
while True:
    clock.tick(60)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.MOUSEBUTTONDOWN:
            print('按下')
        if event.type == pygame.MOUSEBUTTONUP:
            print('弹起')


    ballrect = ballrect.move(speed)
    if ballrect.left < 0 or ballrect.right > 1000:
        speed[0] = -speed[0]
    if ballrect.top < 0 or ballrect.bottom > 800:
        speed[1] = -speed[1]

    screen.fill(sclor)
    screen.blit(ball,ballrect)
    pygame.display.flip()